import basicApi from '@/api/basic'
import constant from '@/utils/constant'
const dic = {
    namespaced: true,
    state: {
        userTypes:[],
        userSexs:[],
        enableds:[],
        deptTypes:[]
    },
    getters: {
    },
    mutations: {
    },
    actions: {
        doUserTypesOfBasic({ commit, state}) {
            return basicApi.doChildDicByCode({code: constant.DIC_CODE.SYSTEM_USERTYPE}).then(result => {
                state.userTypes = result.bean;
                return result;
            });
        },
        doUserSexsOfBasic({ commit, state}) {
            return basicApi.doChildDicByCode({code: constant.DIC_CODE.SYSTEM_SEX}).then(result => {
                state.userSexs = result.bean;
                return result;
            });
        },
        doEnabledOfBasic({ commit, state}) {
            return basicApi.doChildDicByCode({code: constant.DIC_CODE.SYSTEM_ENABLED}).then(result => {
                state.enableds = result.bean;
                return result;
            });
        },
        doDeptTypesOfBasic({ commit, state}) {
            return basicApi.doChildDicByCode({code: constant.DIC_CODE.SYSTEM_DEPT}).then(result => {
                state.deptTypes = result.bean;
                return result;
            });
        },
    }
}

export default dic;
